(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

f(f(X)) → c(n__f(g(n__f(X))))
c(X) → d(activate(X))
h(X) → c(n__d(X))
f(X) → n__f(X)
d(X) → n__d(X)
activate(n__f(X)) → f(X)
activate(n__d(X)) → d(X)
activate(X) → X

Rewrite Strategy: INNERMOST

(1) NestedDefinedSymbolProof (BOTH BOUNDS(ID, ID) transformation)

The following defined symbols can occur below the 0th argument of d: d, f, activate

Hence, the left-hand sides of the following rules are not basic-reachable and can be removed:
f(f(X)) → c(n__f(g(n__f(X))))

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

activate(n__d(X)) → d(X)
activate(n__f(X)) → f(X)
f(X) → n__f(X)
d(X) → n__d(X)
h(X) → c(n__d(X))
activate(X) → X
c(X) → d(activate(X))

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

activate(n__d(X)) → d(X) [1]
activate(n__f(X)) → f(X) [1]
f(X) → n__f(X) [1]
d(X) → n__d(X) [1]
h(X) → c(n__d(X)) [1]
activate(X) → X [1]
c(X) → d(activate(X)) [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

activate(n__d(X)) → d(X) [1]
activate(n__f(X)) → f(X) [1]
f(X) → n__f(X) [1]
d(X) → n__d(X) [1]
h(X) → c(n__d(X)) [1]
activate(X) → X [1]
c(X) → d(activate(X)) [1]

The TRS has the following type information:
activate :: n__d:n__f → n__d:n__f
n__d :: n__d:n__f → n__d:n__f
d :: n__d:n__f → n__d:n__f
n__f :: a → n__d:n__f
f :: a → n__d:n__f
h :: n__d:n__f → n__d:n__f
c :: n__d:n__f → n__d:n__f

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:
none

And the following fresh constants:

const, const1

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

activate(n__d(X)) → d(X) [1]
activate(n__f(X)) → f(X) [1]
f(X) → n__f(X) [1]
d(X) → n__d(X) [1]
h(X) → c(n__d(X)) [1]
activate(X) → X [1]
c(X) → d(activate(X)) [1]

The TRS has the following type information:
activate :: n__d:n__f → n__d:n__f
n__d :: n__d:n__f → n__d:n__f
d :: n__d:n__f → n__d:n__f
n__f :: a → n__d:n__f
f :: a → n__d:n__f
h :: n__d:n__f → n__d:n__f
c :: n__d:n__f → n__d:n__f
const :: n__d:n__f
const1 :: a

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

const => 0
const1 => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ f(X) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ d(X) :|: z = 1 + X, X >= 0
c(z) -{ 1 }→ d(activate(X)) :|: X >= 0, z = X
d(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
f(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
h(z) -{ 1 }→ c(1 + X) :|: X >= 0, z = X

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V),0,[activate(V, Out)],[V >= 0]).
eq(start(V),0,[f(V, Out)],[V >= 0]).
eq(start(V),0,[d(V, Out)],[V >= 0]).
eq(start(V),0,[h(V, Out)],[V >= 0]).
eq(start(V),0,[c(V, Out)],[V >= 0]).
eq(activate(V, Out),1,[d(X1, Ret)],[Out = Ret,V = 1 + X1,X1 >= 0]).
eq(activate(V, Out),1,[f(X2, Ret1)],[Out = Ret1,V = 1 + X2,X2 >= 0]).
eq(f(V, Out),1,[],[Out = 1 + X3,X3 >= 0,V = X3]).
eq(d(V, Out),1,[],[Out = 1 + X4,X4 >= 0,V = X4]).
eq(h(V, Out),1,[c(1 + X5, Ret2)],[Out = Ret2,X5 >= 0,V = X5]).
eq(activate(V, Out),1,[],[Out = X6,X6 >= 0,V = X6]).
eq(c(V, Out),1,[activate(X7, Ret0),d(Ret0, Ret3)],[Out = Ret3,X7 >= 0,V = X7]).
input_output_vars(activate(V,Out),[V],[Out]).
input_output_vars(f(V,Out),[V],[Out]).
input_output_vars(d(V,Out),[V],[Out]).
input_output_vars(h(V,Out),[V],[Out]).
input_output_vars(c(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [d/2]
1. non_recursive : [f/2]
2. non_recursive : [activate/2]
3. non_recursive : [c/2]
4. non_recursive : [h/2]
5. non_recursive : [start/1]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is completely evaluated into other SCCs
2. SCC is partially evaluated into activate/2
3. SCC is partially evaluated into c/2
4. SCC is completely evaluated into other SCCs
5. SCC is partially evaluated into start/1

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations activate/2
* CE 6 is refined into CE [9]
* CE 7 is refined into CE [10]


### Cost equations --> "Loop" of activate/2
* CEs [9,10] --> Loop 4

### Ranking functions of CR activate(V,Out)

#### Partial ranking functions of CR activate(V,Out)


### Specialization of cost equations c/2
* CE 8 is refined into CE [11]


### Cost equations --> "Loop" of c/2
* CEs [11] --> Loop 5

### Ranking functions of CR c(V,Out)

#### Partial ranking functions of CR c(V,Out)


### Specialization of cost equations start/1
* CE 2 is refined into CE [12]
* CE 3 is refined into CE [13]
* CE 4 is refined into CE [14]
* CE 5 is refined into CE [15]


### Cost equations --> "Loop" of start/1
* CEs [12,13,14,15] --> Loop 6

### Ranking functions of CR start(V)

#### Partial ranking functions of CR start(V)


Computing Bounds
=====================================

#### Cost of chains of activate(V,Out):
* Chain [4]: 2
with precondition: [V=Out,V>=0]


#### Cost of chains of c(V,Out):
* Chain [5]: 4
with precondition: [V+1=Out,V>=0]


#### Cost of chains of start(V):
* Chain [6]: 5
with precondition: [V>=0]


Closed-form bounds of start(V):
-------------------------------------
* Chain [6] with precondition: [V>=0]
- Upper bound: 5
- Complexity: constant

### Maximum cost of start(V): 5
Asymptotic class: constant
* Total analysis performed in 36 ms.

(12) BOUNDS(1, 1)